﻿#region Header
// Copyright 2007-2011, Jerónimo Milea
// 
// This file is part of NetJsWire.
// 
//     NetJsWire is free software: you can redistribute it and/or modify
//     it under the terms of the GNU General Public License as published by
//     the Free Software Foundation, either version 3 of the License, or
//     (at your option) any later version.
// 
//     NetJsWire is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General Public License for more details.
// 
//     You should have received a copy of the GNU General Public License
//     along with NetJsWire.  If not, see <http://www.gnu.org/licenses/>.
#endregion

using System;
using System.ComponentModel;
using NetJsWire.JsonRpcHandler;

namespace NetJsWire.Widgets.Config
{
    [TypeConverter( typeof( ExpandableObjectConverter ) ), TypeDescriptionProvider( typeof( ConfigOptionsPropertys ) )]
    [Serializable]
    public class FieldConfigOptions : BoxComponentConfigOptions
    {
        public FieldConfigOptions( IWidget ownerWidget )
            : base( ownerWidget )
        {
            base.FieldClass = "x-form-field";
            base.FocusClass = "x-form-focus";
        }

        [Description( "The default CSS class for the field (defaults to 'x-form-field')." )]
        [DefaultValue( "x-form-field" )]
        [Browsable( true )]
        public override string FieldClass
        {
            get
            {
                return base.FieldClass;
            }
            set
            {
                SetValue( "fieldClass", value, "x-form-field", base.FieldClass );
                base.FieldClass = value;
            }
        }

        [Description( "The CSS class to use when the field receives focus (defaults to 'x-form-focus')." )]
        [DefaultValue( "x-form-focus" )]
        [Browsable( true )]
        public override string FocusClass
        {
            get
            {
                return base.FocusClass;
            }
            set
            {
                SetValue( "focusClass", value, "x-form-focus", base.FocusClass );
                base.FocusClass = value;
            }
        }

        [Description( "The field's HTML name attribute (defaults to ''). Note: this property must be set if this field is to be automatically included with form submit()." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        public override string Name
        {
            get
            {
                return base.Name;
            }
            set
            {
                SetValue( "name", value, null, base.Name );
                base.Name = value;
            }
        }
    }
}
